# Maintainer: Sorah Fukumori <her@sorah.jp>
# FIXME: current AUR HEAD is completely broken, so written by scratch

pkgname=fluent-bit

pkgver=1.3.6
pkgrel=2

pkgdesc='Collect data/logs from different sources, unify and send them to multiple destinations.'
arch=('x86_64')
url="https://fluentbit.io/"
license=('Apache')

depends=()
makedepends=(cmake)

backup=('etc/fluent-bit/fluent-bit.conf'
        'etc/fluent-bit/parsers.conf'
        'etc/fluent-bit/plugins.conf')
source=("https://fluentbit.io/releases/${pkgver%.*}/$pkgname-$pkgver.tar.gz")

build() {
    cd $pkgname-$pkgver/build
    cmake \
        -DCMAKE_INSTALL_PREFIX=/usr \
        -DCMAKE_INSTALL_SYSCONFDIR=/etc \
        -DFLB_TESTS_INTERNAL=Yes \
        -DFLB_TESTS_RUTNIME=Yes \
        ..
    make
}

check() {
    cd $pkgname-$pkgver/build
    make test
}

package() {
    cd $pkgname-$pkgver/build
    make DESTDIR="$pkgdir/" install
    mkdir -p $pkgdir/usr/lib
    mv $pkgdir/lib/systemd $pkgdir/usr/lib/systemd
    rm -rf $pkgdir/lib
}

sha256sums=('11d3610d08c2987f85dbe77f3ff802d578534b59da2f16cc947befea7c4cef36')
sha512sums=('62736daadf61da9b1f4b0e15c9eb526d027db89590b740bdf08d0bd43d4c6960706b0056f09ad162af06324558eb5f9a0c391936505e1ffc49f3b2fc7d778f3d')
